<?php
require_once __DIR__ .  '/../ZendPartial.php';

class ZendPartial_FormController extends ZendPartialController
{
    /** テンプレートファイル名 */
    const NAME_TEMPLATE = 'form.tpl';

    /** 入力フォーム終了タグ定数 */
    const TAG_FORMEND = '</form>';

    /** ネーム */
    public $NAME;
    /** アクション */
    public $ACTION;
    /** メソッド */
    public $METHOD;

    public function __construct($Name, $Action, $Method, $TemplateDir='')
    {
        if ($TemplateDir == ''){
            $TemplateDir = __DIR__;
        }
        parent::__construct($TemplateDir);
        $this->NAME = $Name;
        $this->ACTION = $Action;
        $this->METHOD = $Method;
    }

    public function fetchStart($TemplateFileName='')
    {
        if ($TemplateFileName == '') {
            $TemplateFileName = self::NAME_TEMPLATE;
        }
        $this->view->NAME = $this->NAME;
        $this->view->ACTION = $this->ACTION;
        $this->view->METHOD = $this->METHOD;
        $sHtml = parent::fetch($TemplateFileName);
        return $sHtml;
    }

    public function fetchEnd()
    {
        return '</form>';
    }
}
